<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>ajax</title>
	<script type="text/javascript" src="ajaxUtil.js"></script>
	<script type="text/javascript" src="jquery"></script>
	<script>
		window.onload=function(){
			var u = document.getElementById("username").value;
			var e = document.getElementById("email").value;
			var p = document.getElementById("phone").value;

			var ns = document.getElementById("nameSpan");
			var es = document.getElementById("emailSpan");
			var ps = document.getElementById("phoneSpan");
			u.onblur = function(){
				myAjax("get","#","username"+u,text,function(result){
					if(u =="110@qq.com"){
						us.innerHTML = "已被注册";
					}else{
						us.innerHTML ="可以使用";
					}	
				},true);

			}
			e.onblur = function(){
				myAjax2({
					type:"post",
					data:{
						email:e
					},
					dataType:"text",
					success: function(result){
						if(u =="110@qq.com"){
							es.innerHTML = "邮箱已被注册";
						}else{
							es.innerHTML ="邮箱可以使用";
							}
					}
				});

			}
			p.onblur = function(){
				$.ajax({
					dataType:"json",
					data:{
						phone:p
					},
					type:post,
					success: function(){
						if(p =="110@qq.com"){
						ps.innerHTML = "手机号已被注册";
					}else{
						ps.innerHTML ="手机号可以使用";
					}
					}
				});

			}

		}

	</script>
</head>
<body>
	<form action="#" method="get">
		用户名:<input type="text" name="username" id="username"> <span id="nameSpan"></span><br/>
		密&nbsp;码:<input type="password" name="password"><br />
		邮&nbsp;箱:<input type="text" name="email" id="email"> <span id="emailSpan"></span><br/>
		手机号:<input type="text" name="phone" id="phone"> <span id="phoneSpan"></span><br/>
		<input type="submit" value="提交">
	</form>
</body>
</html>